﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExpLib.SSO;
using System.Security.Cryptography;

namespace SSOWebServer
{
    public partial class Login : System.Web.UI.Page
    {
        String privateKey = "<RSAKeyValue><Modulus>n01P4RTisCpUKg+XQWEuOFSBKNWPxsxEZHVVbXl07p6lfdqBAfmgVtetMtKSCFwhLD8sROosoWDqf7ZrniBg1LAYyFpdik4XEAKXuy+qnfB9EnQCvM3LluJlk/Cz1JgEBTy5XKLszfeG5+Xo4QD9VxikOxiapZSo5qg9HML8OXE=</Modulus><Exponent>AQAB</Exponent><P>y4doVLfUOX+J5EUlmN4R+2IvYIjHaVn3rLYCrEgbQ3GAm9fHRc/BtVl6Oon77R3TSuwcybfUlNRG+QKxyctHaw==</P><Q>yF7+5Tf/Oatu4f8CdxmHLY9obb9F/fN+kNPY7HBRmTwopv3f3VyOdSQewpB5af8a1vIIGFM8NMF6H2hbRn9lkw==</Q><DP>U/MOPaN1jiHlJpq+30b5886T7CV+2x2Y40xP3fAADtmKSr2+HDWNmNfHas3vc+aReJ3bYfjJXnoQrDVIUAvg8Q==</DP><DQ>YYMJnVfRF6m8frNx6bA8vwlpku9hCqOzVpwil35Z168VQZ+PkNT4Zz260oko7VK/JxgGpH/tbucxnZNVyEs7jQ==</DQ><InverseQ>f3F2gytVjOLm9EKkFFPktR8kSQ6g+0KQ07h23hrEKUk03puNsXAVR7knmKxv7rrl26Ry4MYlLPiJCVbJX4Bx1g==</InverseQ><D>cDYxUkc39weaCZa54N/ngt5jrLPidxJkCq9r4ZVwfLVbtW84+H8yJnn+EpKpMyJSa6yELncVwQdXp2aEH/qGua5e/nOtVOSY8TUZWcU2gONeqKIdAnib17rI2u1+te8MQfWgJLU8jmDjcaYj4UrkPIu3tOXx9cmmTwsj2NLyphE=</D></RSAKeyValue>";
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
                   

            SSOServer ssoServer = new SSOServer();
            ssoServer.FromXmlString(privateKey);
            TextBox2.Text = ssoServer.SignatueData(TextBox1.Text);
            ssoServer.Dispose();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            SSOServer ssoServer = new SSOServer();
            ssoServer.FromXmlString(privateKey);
            Response.Write(ssoServer.ValidataData(TextBox1.Text, TextBox2.Text));
            ssoServer.Dispose();
        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}